<template>
  <div>
    <div class="content" v-html="agreementContent" v-if="agreementContent"></div>
    <no-data :noData=noData v-else></no-data>
  </div>
</template>
<script>
import {
  getRegInfo
} from '@/api/loginRegister/index'
import noData from '@/components/noData/index'

export default {
  data() {
    return {
      agreementContent: '',
      agreementName: '',
      noData: {
        width: '49%',
        marginTop: '60px',
        txtMarginTop: '-30px',
        img: 'https://img.wifenxiao.com/h5-wfx/images/no_magazine.png',
        text: '协议加载中。。。'
      }
    }
  },
  components: {
    noData
  },
  created() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      getRegInfo({ is_show_pact: 1 }).then(res => {
        if (res.status === 1) {
          const data = res.data
          if (this.$route.name == 'userAgreement') {
            this.agreementContent = data.user_protocols_content
            this.noData.text = '暂无用户协议'
          } else {
            this.agreementContent = data.privacy_policy_content
            this.noData.text = '暂无隐私协议'
          }
        }
      })
    }

  }
}
</script>
<style lang="scss">
.content {
  padding: 30px
}
</style>